package com.bdqn.springbootwebsocket.controller;

import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class WebSocketController {

    @RequestMapping("/login")
    public String login() {
        return "login";
    }

    @RequestMapping("/doLogin")
    public String doLogin(String username, String password, HttpSession session) {
        if (password.equals("123")) {
            session.setAttribute("user", username);
            return "main";
        }
        return "login";


    }

}
